<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例1</title>
    <script src="jquery.js"></script>
    <script>
        function show(){
            console.log($("#username").val());
            $(":checkbox:checked").each(function (index,item){
                console.log(item.value)
            })
        }
    </script>
</head>
<body>
    <div>
        用户名<input name="username" id="username"/><br/>
        密码:<input name="password" id="password"/><br/>
        爱好:<input type="checkbox" name="hobby" value="1"/>游泳
            <input type="checkbox" name="hobby" value="2"/>跑步
            <input type="checkbox" name="hobby" value="3"/>看书<br/>
        <button onclick="show()">点击</button>
    </div>
</body>
</html>